[torch.compile] Passing only necessary compilation config to inductor pass config#27041
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors how compilation configuration is passed to the VllmInductorPass. Instead of passing a weak reference to the entire CompilationConfig, it now passes a new SimplifiedCompilationConfig object containing only the necessary fields. This is a great improvement for safety and decoupling, as it avoids passing potentially dangerous pointers (like static_forward_context) into the torch.compile process. However, I've identified a critical type mismatch in the new SimplifiedCompilationConfig dataclass that needs to be addressed.
d161999 to
170f61e
Compare
170f61e to
b8b8c71
Compare
b8b8c71 to
31ef04c
Compare
31ef04c to
cdb1bfd
Compare
…lm-project#27041) Summary: Pull Request resolved: vllm-project#27041 we should not pass the weakref to compilation_config, which include static_forward_context that will holds the pointers to the model layers (e.g. moe, attention), which is dangerous, as this will be passed as config to torch.compile Test Plan: local tests Differential Revision: D84790018 Signed-off-by: Lu Fang <fanglu@fb.com>
cdb1bfd to
948efa4
Compare
948efa4 to
5493d3c
Compare
5493d3c to
1fd5983
Compare
| use_inductor_graph_partition=config.use_inductor_graph_partition, | ||
| compile_sizes=config.compile_sizes, | ||
| ) | ||
| self.pass_config = config.compilation_config.pass_config |
There was a problem hiding this comment.
later pass_config can be also moved.
There was a problem hiding this comment.
I think we can utilize it, but it will introduce duplicated attribute in config level, we can think of how to organize these config better in following PR. @zou3519
Signed-off-by: Lu Fang <fanglu@fb.com>
Signed-off-by: Lu Fang <fanglu@fb.com>
… pass config (vllm-project#27041) Signed-off-by: Lu Fang <fanglu@fb.com> Co-authored-by: Lucia (Lu) Fang <fanglu@meta.com>
… pass config (vllm-project#27041) Signed-off-by: Lu Fang <fanglu@fb.com> Co-authored-by: Lucia (Lu) Fang <fanglu@meta.com>
… pass config (vllm-project#27041) Signed-off-by: Lu Fang <fanglu@fb.com> Co-authored-by: Lucia (Lu) Fang <fanglu@meta.com> Signed-off-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>
… pass config (vllm-project#27041) Signed-off-by: Lu Fang <fanglu@fb.com> Co-authored-by: Lucia (Lu) Fang <fanglu@meta.com> Signed-off-by: 0xrushi <6279035+0xrushi@users.noreply.github.com>
… pass config (vllm-project#27041) Signed-off-by: Lu Fang <fanglu@fb.com> Co-authored-by: Lucia (Lu) Fang <fanglu@meta.com>
… pass config (vllm-project#27041) Signed-off-by: Lu Fang <fanglu@fb.com> Co-authored-by: Lucia (Lu) Fang <fanglu@meta.com>
Summary: we should not pass the weakref to compilation_config, which include static_forward_context that will holds the pointers to the model layers (e.g. moe, attention), which is dangerous, as this will be passed as config to torch.compile
Differential Revision: D84790018